/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package caintra.Sapra.ComponentsImplements;

import caintra.Sapra.Model.Calendariofacturacionpracticantes;
import caintra.Sapra.Model.Empresa;
import java.util.List;
import nextapp.echo2.app.Border;
import nextapp.echo2.app.Color;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.Font;
import nextapp.echo2.app.SelectField;
import nextapp.echo2.app.list.DefaultListModel;

/**
 *
 * @author Administrador
 */
public class SelectFieldCaintra extends SelectField{

    public SelectFieldCaintra(String command,int Width){
         this.setActionCommand(command);
         this.setWidth(new Extent(Width));
         this.setFont(new Font(Font.TIMES_NEW_ROMAN, 1, new Extent(10,Extent.PX)));
         this.setBorder(new  Border(new Extent(2, Extent.PX), Color.BLACK, 1));

    }

    public void Modelo_Periodo(List<Calendariofacturacionpracticantes> lista){
        try {
            this.removeAll();
            this.setModel(new DefaultListModel(lista.toArray()));
            this.getSelectionModel().clearSelection();
        } catch (Exception e) {
            this.setModel(new DefaultListModel());
        }
    }

    public void Modelo_Empresa(List<Empresa> lista){
        try {
            this.removeAll();
            this.setModel(new DefaultListModel(lista.toArray()));
            this.getSelectionModel().clearSelection();
        } catch (Exception e) {
            this.setModel(new DefaultListModel());
        }
    }

    public void ModeloVistaReporte(){
        DefaultListModel vista=null;
        try{
        vista=new DefaultListModel();
        vista.add("PDF");
        vista.add("EXCEL");
        this.setModel(vista);
        }catch (Exception e){
            this.setModel(vista);
        }
    }

}
